package cn.rubintry.bug.hunting.adapter

import android.content.Context
import android.graphics.Color
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.TextView
import cn.rubintry.bug.hunting.R
import cn.rubintry.bug.hunting.pojo.HistoryModel
import com.blankj.utilcode.util.ShadowUtils
import com.chad.library.adapter4.BaseQuickAdapter
import com.chad.library.adapter4.viewholder.QuickViewHolder

class HistoryAdapter(private val mData: MutableList<HistoryModel>) : BaseQuickAdapter<HistoryModel , QuickViewHolder>(mData) {
    override fun onBindViewHolder(holder: QuickViewHolder, position: Int, item: HistoryModel?) {
        holder.getView<TextView>(R.id.tvTitle).text = item?.title ?: ""
        holder.getView<TextView>(R.id.tvSampleContent).text = item?.sampleContent ?: ""
        val linearLayout = holder.getView<LinearLayout>(R.id.llHistoryContainer)
        ShadowUtils.apply(linearLayout , ShadowUtils.Config().setShadowRadius(40f).setShadowColor(
            Color.parseColor("#11000000")).setShadowSize(30))
    }

    override fun onCreateViewHolder(
        context: Context,
        parent: ViewGroup,
        viewType: Int
    ): QuickViewHolder {
        return QuickViewHolder(R.layout.item_history , parent)
    }
}